package com.xy.minio;

import io.minio.*;
import io.minio.errors.*;

import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class FileUploader {
    public static void main(String[] args) throws NoSuchAlgorithmException, IOException, InvalidKeyException, InvalidResponseException, BucketPolicyTooLargeException, ServerException, InternalException, XmlParserException, InvalidBucketNameException, InsufficientDataException, ErrorResponseException, RegionConflictException {
        MinioClient client = MinioClient
                .builder()
                .endpoint("http://106.12.149.245:9000")
                .credentials("admin", "admin123")
                .build();
        if (!client.bucketExists(BucketExistsArgs.builder().bucket("test").build())) {
            client.makeBucket(MakeBucketArgs.builder().bucket("test").build());
        }
        client.uploadObject(
                UploadObjectArgs.builder()
                .bucket("test")
                .object("hhh/aaa")
                .filename("C:\\Users\\WHhykj558\\Desktop\\2.6增量2.sql")
                .build()
        );
    }
}
